﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Ranji_2017_Umlite
{
    public partial class Zongmao_component : UserControl
    {
        private int machine_num = 0;
        public Zongmao_component()
        {
            InitializeComponent();
        }

        public void Set_machine_num(int num)
        {
            // 设置站号
            machine_num = num;
            label_machine_num.Text = num.ToString();
        }

        public void Set_duanhao(int num)
        {
            // 设置段号
            label_yunxingduanhao.Text = num.ToString();
        }

        public void Set_wendu(int num)
        {
            // 设置机缸温度
            label_wendu.Text = num.ToString()+" ℃";
        }
        
        public void Set_shuiwei(int num)
        {
            // 设置机缸水位
            label_jigangshuiwei.Text = num.ToString() + " cm";
        }

        public void Set_Liaogangwendu(int num)
        {
            // 料缸温度
            label_liaogangwendu.Text = num.ToString() + " ℃";
        }

        public void Set_Liaogangshuiwei(int num)
        {
            // 料缸水位
            label_liaogangshuiwei.Text = num.ToString() + " cm";
        }

        public void Set_Dangqiangongyi(string dangqiangongyi)
        {
            // 设置当前工艺
            label_dangqiangongyi.Text = dangqiangongyi;
        }

        public void Set_MubiaoWendu(int num)
        {
            // 设置目标温度
            label_mubiao.Text = num.ToString() + " ℃ ";
        }

        public void Set_Zongyunxing(int num)
        {
            // 设置总运行时间
            DateTime mytime = DateTime.Parse("00:00:00");
            mytime = mytime.AddSeconds(num);
            label_zongruntime.Text = mytime.ToString("HH:mm:ss");
        }

        public void Set_Duanyunxing(int num)
        {
            // 设置段运行时间
            DateTime mytime = DateTime.Parse("00:00:00");
            mytime = mytime.AddSeconds(num);
            label_duanruntime.Text = mytime.ToString("HH:mm:ss");
        }

        public void Set_jiare(bool istrue)
        {
            // 设置加热选项
            if (istrue == true) 
            {
                label_jiare.BackColor = System.Drawing.Color.Red;
                return;
            }
            if (istrue == false)
            {
                label_jiare.BackColor = System.Drawing.Color.White;
                return;
            }
        }

        public void Set_lengque(bool istrue)
        {
            // 设置冷却选项
            if (istrue == true)
            {
                label_lengque.BackColor = System.Drawing.Color.Blue;
                label_lengque.ForeColor = System.Drawing.Color.White;
                return;
            }
            if (istrue == false)
            {
                label_lengque.BackColor = System.Drawing.Color.White;
                label_lengque.ForeColor = System.Drawing.Color.Black;
                return;
            }
        }

        public void Set_jinshui1(bool istrue)
        {
            // 设置进水1
            if(istrue==true)
            {
                label_jinshui1.BackColor = System.Drawing.Color.Green;
                return;
            }
            if(istrue==false)
            {
                label_jinshui1.BackColor = System.Drawing.Color.White;
                return;
            }
        }

        public void Set_jinshui2(bool istrue)
        {
            // 设置进水2
            if(istrue==true)
            {
                label_jinshui2.BackColor = System.Drawing.Color.Green;
                return;
            }
            if(istrue==false)
            {
                label_jinshui2.BackColor = System.Drawing.Color.White;
                return;
            }
        }

        public void Set_jinshui3(bool istrue)
        {
            // 设置进水3
            if(istrue==true)
            {
                label_jinshui3.BackColor = System.Drawing.Color.Green;
                return;
            }
            if(istrue==false)
            {
                label_jinshui3.BackColor = System.Drawing.Color.White;
                return;
            }
        }

        public void Set_paishui1(bool istrue)
        {
            // 设置排水1
            if(istrue==true)
            {
                label_paishui1.BackColor = System.Drawing.Color.Green;
                return;
            }
            if(istrue==false)
            {
                label_paishui1.BackColor = System.Drawing.Color.White;
                return;
            }
        }

        public void Set_paishui2(bool istrue)
        {
            // 设置排水2
            if(istrue==true)
            {
                label_paishui2.BackColor = System.Drawing.Color.Green;
                return;
            }
            if(istrue==false)
            {
                label_paishui2.BackColor = System.Drawing.Color.White;
                return;
            }
        }

        public void Set_paishui3(bool istrue)
        {
            // 设置排水3
            if(istrue==true)
            {
                label_paishui3.BackColor = System.Drawing.Color.Green;
                return;
            }
            if(istrue==false)
            {
                label_paishui3.BackColor = System.Drawing.Color.White;
                return;
            }
        }
        public void Set_shushui(bool istrue)
        {
            // 设置疏水
            if(istrue==true)
            {
                label_shushui.BackColor = System.Drawing.Color.Green;
                return;
            }
            if(istrue==false)
            {
                label_shushui.BackColor = System.Drawing.Color.White;
                return;
            }
        }

        public void Set_yiliu(bool istrue)
        {
            // 设置溢流
            if(istrue==true)
            {
                label_yiliu.BackColor = System.Drawing.Color.Green;
                return;
            }
            if(istrue==false)
            {
                label_yiliu.BackColor = System.Drawing.Color.White;
                return;
            }
        }

        public void Set_qidong(bool istrue)
        {
            // 设置启动
            if(istrue==true)
            {
                label_qidong.BackColor = System.Drawing.Color.Green;
                return;
            }
            if(istrue==false)
            {
                label_qidong.BackColor = System.Drawing.Color.White;
                return;
            }
        }

        public void Set_tingzhi(bool istrue)
        {
            // 设置停止
            if(istrue==true)
            {
                label_tingzhi.BackColor = System.Drawing.Color.Red;
                return;
            }
            if(istrue==false)
            {
                label_tingzhi.BackColor = System.Drawing.Color.White;
                return;
            }
        }

        public void Set_shouzidong(bool istrue)
        {
            // 设置手自动
            if(istrue==true)
            {
                label_shouzidong.BackColor = System.Drawing.Color.Green;
                label_shouzidong.Text = "自动";
                return;
            }
            if(istrue==false)
            {
                label_shouzidong.BackColor = System.Drawing.Color.White;
                label_shouzidong.Text = "手动";
                return;
            }
        }

        public void Set_tongxun(bool istrue)
        {
            // 设置通讯
            if(istrue==true)
            {
                label_tongxun.BackColor = System.Drawing.Color.Yellow;
                return;
            }

            if(istrue==false)
            {
                label_tongxun.BackColor = System.Drawing.Color.LightGray;
                return;
            }
        }
        private void Wendu_control_Load(object sender, EventArgs e)
        {
                     
        }
    }
}
